home *** CD-ROM | disk | FTP | other *** search
- Command sequence
-
- This is a sequence of any the following command formats, where
- each command is terminated by a semicolon or newline. Long command
- lines can be extended by using a back-slash followed by a newline
- character. When this is done, the prompt shows a double angle
- bracket to indicate that the line is still in progress. Certain
- cases will automatically prompt for more input in a similar manner,
- even without the back-slash. The most common case for this is when
- a function is being defined, but is not yet completed.
-
- Each command sequence terminates only on an end of file. In
- addition, commands can consist of expression sequences, which are
- described in the next section.
-
-
- NOTE: Calc commands are in lower case. UPPER case is used below
- for emphasis only, and should be considered in lower case.
-
-
- DEFINE function(params) { body }
- DEFINE function(params) = expression
- This first form defines a full function which can consist
- of declarations followed by many statements which implement
- the function.
-
- The second form defines a simple function which calculates
- the specified expression value from the specified parameters.
- The expression cannot be a statement. However, the comma
- and question mark operators can be useful. Examples of
- simple functions are:
-
- define sumcubes(a, b) = a^3 + b^3;
- define pimod(a) = a % pi();
-
- HELP
- This displays a general help message.
-
- READ filename
- This reads definitions from the specified filename.
- The name can be quoted if desired. The calculator
- uses the CALCPATH environment variable to search
- through the specified directories for the filename,
- similarly to the use of the PATH environment variable.
- If CALCPATH is not defined, then a default path of
- ":/usr/lib/calc" is used (that is, the current directory
- followed by a general calc library directory). The
- ".cal" extension is defaulted for input files, so that
- if "filename" is not found, then "filename.cal" is then
- searched for. The contents of the filename are command
- sequences which can consist of expressions to evaluate
- or functions to define, just like at the top level
- command level.
-
- WRITE filename
- This writes the values of all global variables to the
- specified filename, in such a way that the file can be
- later read in order to recreate the variable values.
- For speed reasons, values are written as hex fractions.
- This command currently only saves simple types, so that
- matrices, lists, and objects are not saved. Function
- definitions are also not saved.
-
- QUIT
- This leaves the calculator, when given as a top-level
- command.
-
-
- Also see the help topic:
-
- statement flow control and declaration statements
-